package day03;

import java.util.Scanner;

/**
 * @author yzg
 * @desc TODO
 * @date 2025/4/10
 */
public class Fibonacci {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入要生成的斐波那契数列项数");
        int n = sc.nextInt(); // 要生成的斐波那契数列项数
        int first = 1, second = 1;

        for (int i = 1; i <= n; i++) {
            if (i == 1) {
                System.out.print(first + " ");
            } else if (i == 2) {
                System.out.print(second + " ");
            } else {
                int next = first + second;
                System.out.print(next + " ");
                first = second;
                second = next;
            }
        }
    }
}
